;
(function($) {
	$.extend({
		shopcar: {},
		shopcarjiesuan: {}
	});
	$.extend($.shopcar, {
		main() {
			var check = function() {
				var shopcarTotalPrice = 0
				var shopcarTotalNumber = 0
				$(".shopcar-list li").each(function() {
					$(this).find(".shopcar-jian").prop("disabled", $(this).find(".shopcar-count").val() === "1") //当input的val为1的时候减号停用
					var shopcarSubtotal = parseFloat($(this).find(".shopcar-unitPrice").text()) * parseInt($(this).find(".shopcar-count").val()) //计算单价乘以数量
					$(this).find(".shopcar-subtotal").text(shopcarSubtotal.toFixed(2)) //将单个物品总价保留两位小数，填入固定位置
					if($(this).find("input[type='checkbox']").prop("checked")) { //checkbox选中的时候总价相加
						shopcarTotalPrice += shopcarSubtotal
						shopcarTotalNumber++
					}
				})
				$(".shopcar-total-price").text(shopcarTotalPrice.toFixed(2)) //总价保留两位小数，填入固定位置
				$(".shopcar-total-number").text(shopcarTotalNumber)
				if($(".shopcar-list li").length === 0) { //如果购物车已清空，全选勾取消
					$(".shopcar-checkAll").prop("checked", false)
				}
			}
			check()
			let userid = $.cookie("userId") //实际为登陆人的userid
			//此处为页面效果代码
			if(($(".shopcar-container").position().top + $(".shopcar-container").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
				$("#shopcar-fixed").addClass("shopcar-total-fixed")
			} else {
				$("#shopcar-fixed").addClass("shopcar-total")
			}
			$(window).scroll(function() {
				if(($(".shopcar-container").position().top + $(".shopcar-container").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
					setTimeout(function() {
						$("#shopcar-fixed").addClass("shopcar-total-fixed").removeClass("shopcar-total")
					}, 400)
				} else {
					setTimeout(function() {
						$("#shopcar-fixed").removeClass("shopcar-total-fixed").addClass("shopcar-total")
					}, 400)
				}
			})
			//登陆后获取的购物车
			if(userid) {
				//只需通过用户id去调取购物车列表
				$.get("/loadshoplist", {
					id: userid
				}, function(data) {

					$(".shopcar-list").empty()
					data.forEach(function(goods) {
						$(".shopcar-list").append(`<li>
				<div class="shopcar-check">
				<input type="checkbox"/>
				</div>
				<div class="shopcar-goods">
				<a href="DetailPages.html?id=${goods.id}"><img src="${goods.img}"/></a>
				<div class="shopcar-type">
						${goods.type}
					</div>
					<div class="shopcar-Title">${goods.title}</div>
				</div>
				<div class="shopcar-unitPrice">
				${(goods.unitPrice*1).toFixed(2)}
				</div>
				<div class="shopcar-number">
				<div style="width: 100px;height: 28px;border: 1px solid #CCCCCC;display: flex;justify-content: space-around;">
				<button  class="shopcar-jian"  data-id="${goods.id}" style="background: none;cursor: pointer;outline: none;-webkit-user-select: none;">-</button>
				<input class="shopcar-count" data-id="${goods.id}" value="${goods.count}" type="text" style="width:45px;height:28px; background:none; text-align:center"/>
				<button class="shopcar-jia"  data-id="${goods.id}" style="background: none;cursor: pointer;outline: none;-webkit-user-select: none;">+</button>
				</div>
				</div>
				<div class="shopcar-subtotal">
				${(goods.unitPrice * 1).toFixed(2)}
				</div>
				<div class="shopcar-del" data-id="${goods.goosid}">
					删除
				</div>
			</li>`)

					})
					check()
				})
				//默认全部生成
				$("input[type='checkbox']").attr("checked", false)
				$(".shopcar-checkAll").prop("checked", false)
				check()

				//此处为总选框，一旦勾选所有复选框一致变化
				$(".shopcar-checkAll").change(function() { //当checkbox勾选变化时
					$(".shopcar-list input[type='checkbox']").prop("checked", $(this).prop("checked")) //！！！总勾选，购物车都勾选；总取消，购物车都取消
					check()
				})

				//此处为遍历商品复选框，若是有一个没有勾选，总选框取消勾选
				$(".shopcar-list").on("change", "input[type='checkbox']", function() {
					var isSelectAll = true
					$(".shopcar-list input[type='checkbox']").each(function() { //购物车有一个没有勾选就取消总勾选
						if(!$(this).prop("checked")) {
							isSelectAll = false
							return false;
						}
					})
					$(".shopcar-checkAll").prop("checked", isSelectAll)
					check()
				})

				//此处为删除商品列
				$(".shopcar-list").on("click", ".shopcar-del", function() {
					var that = parseInt($(this).data("id"))

					if(($(".shopcar-container").position().top + $(".shopcar-container").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
						$("#shopcar-fixed").addClass("shopcar-total-fixed").removeClass("shopcar-total")
					} else {
						$("#shopcar-fixed").removeClass("shopcar-total-fixed").addClass("shopcar-total")
					}
					if(confirm("确定删除吗？")){
					$(this).parent("li").remove()
					}
					//当登陆的时候点击删除同时删除后台购物车对应数据
					$.post("/delshopcarlist", {
						id: that,
						userid: userid
					}, function(data) {

					})
					if($(".shopcar-list li").length === 0) { //如果购物车已清空，全选勾取消
						setTimeout(function() {
							location.href = "shopcarKong.html" //如果购物车清空，跳到Kong页面
						}, 600)
					}
					check()
				})
				//此处为一次性删除购物车
				/*shopcar-delAll*/
				$(".shopcar-delAll").click(function() {
					//全部删除购物车及后台数据接口(清空购物车)
					$.post("/delAllshopcarlist", {
						id: userid
					}, function(data) {

					})
					$(".shopcar-list li").each(function() {
						if($(this).find("input[type='checkbox']").prop("checked")) { //找到已经勾选的
							$(this).remove()
						}
					})
					if($(".shopcar-list li").length === 0) { //如果购物车已清空，全选勾取消
						setTimeout(function() {
							location.href = "shopcarKong.html" //如果购物车清空，跳到Kong页面
						}, 600)
					}
					check()
				})
				//此处为点击+按钮
				$(".shopcar-list").on("click", ".shopcar-jia", function() {
					var thisid = $(this).data("id")
					var newcount = $(this).siblings(".shopcar-count").val()
					newcount++
					//此处点加号同时更新后台
					$.post("/updatecount", {
						id: thisid,
						count: newcount,
						userid: userid
					}, function(data) {
						console.log(data)
					})

					//修改文本框的值
					$(this).siblings(".shopcar-count").val(newcount)
					check()
				})
				//此处为点击-按钮
				$(".shopcar-list").on("click", ".shopcar-jian", function() {
					var thisid = $(this).data("id")
					var newcount = $(this).siblings(".shopcar-count").val()
					newcount--
					//此处点加号同时更新后台
					$.post("/updatecount", {
						id: thisid,
						count: newcount,
						userid: userid
					}, function(data) {
						console.log(data)
					})

					//修改文本框的值
					$(this).siblings(".shopcar-count").val(newcount)
					check()
				})
				//此处为检验所有价格数量及复选框
				//此处为手动输入数量
				$(".shopcar-list").on("blur", ".shopcar-count", function() { //手动输入物品总量
					var that = $(this).data("id")
					var ttht=$(this)
					console.log(that)
					if(isNaN($(this).val())) { //非空验证
						layer.msg("请输入大于0的整数", {
							icon: 5
						})
						$(this).val(1)
						return false;
						check()
					}
					if(parseInt($(this).val()) < 1) { //小于零验证
						layer.msg("请输入大于0的整数", {
							icon: 5
						})
						check()
						$(this).val(1)
						check()
						return false;
					}
					if(parseInt($(this).val()) >= 1) {
						var number=parseInt($(this).val())
						console.log(number)
						/*console.log(1)
						for (var i=0;i<shopcarList.length;i++) {
							if(shopcarList[i].goosid === $(this).data("id")) {
							shopcarList[i]["count"]=parseInt($(this).val());
							break;
						}
						}
						$.cookie("shopcarlist", JSON.stringify(shopcarList))*/
						$.get("/checkStock", {
							id:that
						},function(data) {
							console.log(data.stock)
							
							if(parseInt(data.stock)<number){
								ttht.val(1)
								layer.msg("库存不足", {
							icon: 5
						})
							}
						
						console.log(data.stock)
						check()
						return false;
					})
				}
				})//此处以上都是登录时获取的购物车
				//如果已经登陆则弹窗不显示,延时500毫秒调至结算页
				$(".shopcar-total-jiesuan").click(function() {
					if(!userid) {
						$("body").alertLogin('shopcarjiesuan.html')
					} else {
						var shopcarChecked = []
						$(".shopcar-list li").each(function() {
							if($(this).find("input[type='checkbox']").prop("checked")) { //找到已经勾选的
								var thisid = $(this).find(".shopcar-del").data("id")
								var count = parseInt($(this).find(".shopcar-count").val())
								shopcarChecked.push({
									id: thisid,
									count: count
								})
							}
						}) //在点击结算时候遍历购物车li，生成最终的cookie
						$.cookie("shopcarOrder", JSON.stringify(shopcarChecked))
						$.removeCookie("Lijishopcarlist")
						//在点击结算删除
						setTimeout(function() {
							location.href = "shopcarjiesuan.html"
						}, 500)
					}
				})
			}

			//此处以下都是未登录时获取cookie来生成购物车
			//商品详情页需要绑定商品id（location.search），点击添加购物车是需要存cookie,
			//以便于在购物车页面调取cookie，根据绑定的id去后台请求数据
			//在未登陆的状态下需要存cookie
			//此处为购物车调取数据接口count这个字段可以通过接口update也可以cookie
			//后台数据字段需统一id,img,type,title,unitPrice,count
			//未登录时候通过cookie取后台数据
			if($.cookie("shopcarList")) {
				console.log($.cookie("shopcarList"))
				let shopcarList = JSON.parse($.cookie("shopcarList")) //此处的cookie名需统一
				$.get("/loadGoods", {}, function(data) {
					$(".shopcar-list").empty()
					data.forEach(function(goods) {

						shopcarList.forEach(function(item) {

							if(goods.id === item.goosid) {

								$(".shopcar-list").append(`<li>
				<div class="shopcar-check">
				<input type="checkbox"/>
				
				</div>
				<div class="shopcar-goods">
				<a href="DetailPages.html?id=${goods.id}"><img src="${goods.img}"/></a>
				<div class="shopcar-type">
						${goods.type}
					</div>
					<div class="shopcar-Title">${goods.title}</div>
				</div>
				
				<div class="shopcar-unitPrice">
				${(goods.unitPrice*1).toFixed(2)}
				</div>
				
				<div class="shopcar-number">
				<div style="width: 96px;height: 28px;border: 1px solid #CCCCCC;display: flex;justify-content: space-around;">
				<button  class="shopcar-jian"  data-id="${item.goosid}" style="background: none;cursor: pointer;outline: none;-webkit-user-select: none;">-</button>
				<input class="shopcar-count" data-id="${item.goosid}" value="${item.count}" type="text" style="width:45px;background:none; text-align:center"/>
				<button class="shopcar-jia"  data-id="${item.goosid}" style="background: none;cursor: pointer;outline: none;-webkit-user-select: none;">+</button>
				</div>
				</div>
				
				<div class="shopcar-subtotal">
				${(goods.unitPrice * item.count).toFixed(2)}
				</div>
				
				<div class="shopcar-del" data-id="${item.goosid}">
					删除
				</div>
			</li>`)
							}

						})
						check()
					})

					//默认全部生成
					$("input[type='checkbox']").attr("checked", true)
					$(".shopcar-checkAll").prop("checked", true)
					check()
				})

				//此处为总选框，一旦勾选所有复选框一致变化
				$(".shopcar-checkAll").change(function() { //当checkbox勾选变化时
					$(".shopcar-list input[type='checkbox']").prop("checked", $(this).prop("checked")) //！！！总勾选，购物车都勾选；总取消，购物车都取消
					check()
				})

				//此处为遍历商品复选框，若是有一个没有勾选，总选框取消勾选
				$(".shopcar-list").on("change", "input[type='checkbox']", function() {
					var isSelectAll = true
					$(".shopcar-list input[type='checkbox']").each(function() { //购物车有一个没有勾选就取消总勾选
						if(!$(this).prop("checked")) {
							isSelectAll = false
							return false;
						}
					})
					$(".shopcar-checkAll").prop("checked", isSelectAll)
					check()
				})

				//此处为删除商品列
				$(".shopcar-list").on("click", ".shopcar-del", function() {
					
					var that = $(this)
					if(($(".shopcar-container").position().top + $(".shopcar-container").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
						$("#shopcar-fixed").addClass("shopcar-total-fixed").removeClass("shopcar-total")
					} else {
						$("#shopcar-fixed").removeClass("shopcar-total-fixed").addClass("shopcar-total")
					}
					shopcarList = shopcarList.filter(function(item) {
						return item.goosid !== that.data("id")
					})
					$.cookie("shopcarList", JSON.stringify(shopcarList))
					if(!userid){
						
					
					if(confirm("确定删除吗？")){
					that.parent("li").remove()
					}
					}
					if($(".shopcar-list li").length === 0) { //如果购物车已清空，全选勾取消
						setTimeout(function() {
							location.href = "shopcarKong.html" //如果购物车清空，跳到Kong页面
						}, 600)
					}
					check()
					
				})
				//此处为一次性删除购物车
				/*shopcar-delAll*/
				$(".shopcar-delAll").click(function() { //全部删除购物车
					$(".shopcar-list li").each(function() {
						if($(this).find("input[type='checkbox']").prop("checked")) { //找到已经勾选的
							var thisid = $(this).find(".shopcar-del").data("id")
							//修改Cookie
							shopcarList = shopcarList.filter(function(item) { //从购物车数组中删除
								return item.goosid !== thisid
							})
							$.cookie("shopcarList", JSON.stringify(shopcarList)) //从cookie中删除*/
							$(this).remove()
						}
					})
					if($(".shopcar-list li").length === 0) { //如果购物车已清空，全选勾取消
						setTimeout(function() {
							location.href = "shopcarKong.html" //如果购物车清空，跳到Kong页面
						}, 600)
					}
					check()
				})
				//此处为点击+按钮
				$(".shopcar-list").on("click", ".shopcar-jia", function() {
					console.log(1)
					var thisid = $(this).data("id")
					var newcount;
					//修改Cookie
					for(var i = 0; i < shopcarList.length; i++) {
						if(shopcarList[i].goosid === thisid) {
							shopcarList[i].count++;
							newcount = shopcarList[i].count
							break;
						}
					}

					$.cookie("shopcarList", JSON.stringify(shopcarList))
					console.log($.cookie("shopcarList"))
					//修改文本框的值
					$(this).siblings(".shopcar-count").val(newcount)
					check()
				})
				//此处为点击-按钮
				$(".shopcar-list").on("click", ".shopcar-jian", function() {

					var thisid = $(this).data("id")
					var newcount;
					//修改Cookie
					for(var i = 0; i < shopcarList.length; i++) {
						if(shopcarList[i].goosid === thisid) {
							shopcarList[i].count--;
							newcount = shopcarList[i].count
							break;
						}
					}

					$.cookie("shopcarList", JSON.stringify(shopcarList))
					console.log($.cookie("shopcarList"))
					//修改文本框的值
					$(this).siblings(".shopcar-count").val(newcount)
					check()
				})
				//此处为检验所有价格数量及复选框

				//此处为手动输入数量
				$(".shopcar-list").on("blur", ".shopcar-count", function() { //手动输入物品总量
					var that=$(this).data("id")
					var ttht=$(this)
					if(isNaN($(this).val())) { //非空验证
						layer.msg("请输入大于0的整数", {
							icon: 5
						})
						$(this).val(1)
						console.log(1)
						return false;
						check()
					}
					if(parseInt($(this).val()) < 1) { //小于零验证
						layer.msg("请输入大于0的整数", {
							icon: 5
						})
						check()
						$(this).val(1)
						check()
						return false;
					}
					if(parseInt($(this).val()) >= 1) {
						var number=parseInt($(this).val())

						for(var i = 0; i < shopcarList.length; i++) {

							if(shopcarList[i].goosid === $(this).data("id")) {
								shopcarList[i]["count"] = parseInt($(this).val());
								console.log(1)
								break;
							}

						}
						$.get("/checkStock", {
							id:that
						},function(data) {
							console.log(data.stock)
							if(parseInt(data.stock)<number){
								ttht.val(1)
								layer.msg("库存不足", {
							icon: 5
						})
							}
							
							console.log(1)
						check()
						return false;
					})
						
						$.cookie("shopcarList", JSON.stringify(shopcarList))
						console.log($.cookie("shopcarList"))
						check()
						
						return false;

					}
				}) //此处以上都是未登录时存cookie获取的购物车
				//如果已经登陆则弹窗不显示,延时500毫秒调至结算页
				$(".shopcar-total-jiesuan").click(function() {
					if(!userid) {
						$("body").alertLogin('shopcarjiesuan.html')
					} else {
						var shopcarChecked = []
						$(".shopcar-list li").each(function() {
							if($(this).find("input[type='checkbox']").prop("checked")) { //找到已经勾选的
								var thisid = $(this).find(".shopcar-del").data("id")
								var count = parseInt($(this).find(".shopcar-count").val())
								shopcarChecked.push({
									id: thisid,
									count: count
								})
							}
						})
						$.cookie("shopcarOrder", JSON.stringify(shopcarChecked))

						setTimeout(function() {
							location.href = "shopcarjiesuan.html"
						}, 500)
					}
				})
			}

		}

	})

	//为结算页代码此页只能在登陆后存了用户id后才能跳转到此页
	$.extend($.shopcarjiesuan, {
		main() {
			//此处为取登录时候的cookie（userId）
			let userid = $.cookie("userId") //实际为登陆人的userid
			let userAddress
			if(userid) {
				$.get("/appendAddress", {
					userid: userid
				}, function(data) {
					if(data[0].address) {
						$(".shopcarjiesuan-address").text(data[0].address)
					}
				})
			}

			//此处为添加用户收件地址
			$(".shopcarjiesuan-address").click(function() {
				if(userid) {
					$(".shopcarjiesuan-addaddress").css("display", "block")
				}
			})

			$(".shopcarjiesuan-baocun").click(function() {
				//登陆时方可添加地址，

				if($(".shopcarjiesuan-addaddress textarea").val()) {
					$(".shopcarjiesuan-address").text($(".shopcarjiesuan-addaddress textarea").val())
					userAddress = $(".shopcarjiesuan-address").text()
					$('.shopcarjiesuan-addaddress').css("display", "none")
				}
				//此处为上传地址接口
				$.post("/addAddress", {
					address: userAddress,
					userid: userid
				}, function(data) {

				})

			})
			$(".shopcarjiesuan-quxiao").click(function() {
				/*alert($(this).text())*/
				setTimeout(function() {
					$('.shopcarjiesuan-addaddress').hide()
				}, 0)

				//$('.shopcarjiesuan-addaddress').css("display","none")

			})
			//修改用户地址
			$(".repair").click(function() {
				setTimeout(function() {
					$(".shopcarjiesuan-repairAddress").css("display", "block")
				}, 0)
			})

			$(".shopcarrepair-baocun").click(function() {
				if($(".shopcarjiesuan-repairAddress textarea").val()) {
					$(".shopcarjiesuan-address").text($(".shopcarjiesuan-repairAddress textarea").val())
					userAddress = $(".shopcarjiesuan-address").text()
					setTimeout(function() {
						$('.shopcarjiesuan-repairAddress').css("display", "none")
					}, 0)
				}
				//此处为修改地址接口
				$.post("/repairAddress", {
					address: userAddress,
					userid: userid
				}, function(data) {})
			})
			$(".shopcarrepair-quxiao").click(function() {
				/*alert($(this).text())*/
				setTimeout(function() {
					$('.shopcarjiesuan-repairAddress').hide()
				}, 0)
				//$('.shopcarjiesuan-addaddress').css("display","none")
			})
			//此为结算框效果
			if(($(".shopcarjiesuan-list").position().top + 140 + $(".shopcarjiesuan-list").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
				$("#shopcarjiesuan").addClass("shopcarjiesuan-jiesuan-fixed")

			} else {
				$("#shopcarjiesuan").addClass("shopcarjiesuan-jiesuan")

			}

			$(window).scroll(function() {
				if(($(".shopcarjiesuan-list").position().top + 140 + $(".shopcarjiesuan-list").outerHeight()) - $(window).scrollTop() > $(window).innerHeight()) {
					setTimeout(function() {
						$("#shopcarjiesuan").addClass("shopcarjiesuan-jiesuan-fixed").removeClass("shopcarjiesuan-jiesuan")
					}, 400)
				} else {
					setTimeout(function() {
						$("#shopcarjiesuan").removeClass("shopcarjiesuan-jiesuan-fixed").addClass("shopcarjiesuan-jiesuan")
					}, 400)

				}

			})
			//
			$(".shopcarjiesuan-total-jiesuan").click(function() {
				layer.msg("提交成功", {
					icon: 6
				}, 500)
			})
			//此为自己测试数据
			//如果没有点击立即购买，订单页生成内容为购物车选中数据
			if(!$.cookie("Lijishopcarlist")) {
				var shopcarjiesuanOrder = JSON.parse($.cookie("shopcarOrder")) //从cookie中提取字符串，并转为数组
				$.get("/loadGoods", {}, function(data) {

					data.forEach(function(goods) {

						shopcarjiesuanOrder.forEach(function(item) {

							if(goods.id === item.id) {
								$(".shopcarjiesuan-list").append(`<li>
					<div class="shopcarjiesuan-goods">
					<a href="DetailPages.html?id=${goods.id}"><img src="${goods.img}"/></a>
						<div class="shopcarjiesuan-Title">${goods.title}</div>
				</div>
				<div class="shopcarjiesuan-unitPrice">${(goods.unitPrice*1)}元</div>
				<div class="shopcarjiesuan-count" data-id="${goods.id}">${item.count}</div>
				<div class="shopcarjiesuan-subtotal">${(goods.unitPrice *item.count)}元</div>
				</li>`)
							}
						})
					})
					check()
				})

			}
			//此处为点击立即购买后执行以下代码
			else {
				var shopcarjiesuanOrder = JSON.parse($.cookie("Lijishopcarlist")) //从cookie中提取字符串，并转为数组
				$.get("/loadGoods", {}, function(data) {

					data.forEach(function(goods) {
						shopcarjiesuanOrder.forEach(function(item) {
							if(goods.id === item.id) {
								$(".shopcarjiesuan-list").append(`<li>
					<div class="shopcarjiesuan-goods">
					<a href="DetailPages.html?id=${goods.id}"><img src="${goods.img}"/></a>
						<div class="shopcarjiesuan-Title">${goods.title}</div>
				</div>
				<div class="shopcarjiesuan-unitPrice">${(goods.unitPrice*1)}元</div>
				<div class="shopcarjiesuan-count" data-id="${goods.id}">${item.count}</div>
				<div class="shopcarjiesuan-subtotal">${(goods.unitPrice *item.count)}元</div>
				</li>`)
							}
						})
					})
					check()

				})

			}

			//此处为创建订单接口,点击提交订单后创建
			$(".shopcarjiesuan-total-jiesuan").click(function() {
				$(".shopcarjiesuan-list li").each(function() {
					var goodsid = $(this).find(".shopcarjiesuan-count").data("id")
					var count = parseInt($(this).find(".shopcarjiesuan-count").text())
					var orderNumber = Math.round(Math.random() * 1000000000000000) + 8000000000000000
					var totalPrice = parseInt($(".shopcarjiesuan-total-price").text())
					$.post("/createOrder", {
						count: count,
						userid: userid,
						orderNumber: orderNumber,
						totalPrice: totalPrice,
						goodsid: goodsid
					}, function(data) {

					})

				})
				javascript: window.open("orderform.html", "_blank")
				var start = new Date()
				var starttime = new Date(start).getTime()
				localStorage.setItem("startTime", starttime)

			})
			var check = function() {
				var shopcarjiesuanTotalPrice = 0
				var shopcarjiesuanTotalNumber = 0
				$(".shopcarjiesuan-list li").each(function() {
					var shopcarSubtotal = parseFloat($(this).find(".shopcarjiesuan-subtotal").text())
					shopcarjiesuanTotalPrice += shopcarSubtotal
					shopcarjiesuanTotalNumber++
				})
				$(".shopcarjiesuan-total-price").text(shopcarjiesuanTotalPrice.toFixed(2)) //总价保留两位小数，填入固定位置
				$(".shopcarjiesuan-total-number").text(shopcarjiesuanTotalNumber)
			}
			check()
			//

		}
	})

})(jQuery)